/*     */ package com.newcrm.bean;
/*     */ 
/*     */ import com.newcrm.util.Util;
/*     */ import java.io.Serializable;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class User
/*     */   implements Serializable
/*     */ {
/*     */   private static final long serialVersionUID = -1247700265083699096L;
/*  18 */   public int companyId = -1;
/*  19 */   public String userId = null;
/*  20 */   public String name = null;
/*  21 */   public String email = null;
/*  22 */   public String imgPath = null;
/*  23 */   public int sex = 1;
/*  24 */   public String idCard = null;
/*  25 */   public String mobile = null;
/*  26 */   public String qq = null;
/*  27 */   public Date hireDate = null;
/*     */ 
/*  29 */   public boolean isAdmin = false;
/*     */ 
/*  31 */   public boolean isCreater = false;
/*     */ 
/*  33 */   public boolean canExport = false;
/*  34 */   public boolean canDelete = false;
/*     */ 
/*  36 */   public int groupId = -1;
/*  37 */   public int parentGroupId = -1;
/*     */ 
/*  39 */   public boolean isGroupAdmin = false;
/*     */ 
/*  41 */   public Map<Integer, String> extInfo = new HashMap();
/*     */ 
/*     */   public int getCompanyId() {
/*  44 */     return this.companyId;
/*     */   }
/*     */ 
/*     */   public String getUserId() {
/*  48 */     return this.userId;
/*     */   }
/*     */ 
/*     */   public String getName() {
/*  52 */     return this.name;
/*     */   }
/*     */ 
/*     */   public String getEmail() {
/*  56 */     return this.email;
/*     */   }
/*     */ 
/*     */   public String getImgPath() {
/*  60 */     return this.imgPath;
/*     */   }
/*     */ 
/*     */   public boolean isAdmin() {
/*  64 */     return this.isAdmin;
/*     */   }
/*     */ 
/*     */   public int getSax() {
/*  68 */     return this.sex;
/*     */   }
/*     */ 
/*     */   public void setSax(int sex) {
/*  72 */     this.sex = sex;
/*     */   }
/*     */ 
/*     */   public String getIdCard() {
/*  76 */     return this.idCard;
/*     */   }
/*     */ 
/*     */   public void setIdCard(String idCard) {
/*  80 */     this.idCard = idCard;
/*     */   }
/*     */ 
/*     */   public String getMobile() {
/*  84 */     return this.mobile;
/*     */   }
/*     */ 
/*     */   public void setMobile(String mobile) {
/*  88 */     this.mobile = mobile;
/*     */   }
/*     */ 
/*     */   public String getQq() {
/*  92 */     return this.qq;
/*     */   }
/*     */ 
/*     */   public void setQq(String qq) {
/*  96 */     this.qq = qq;
/*     */   }
/*     */ 
/*     */   public Date getHireDate() {
/* 100 */     return this.hireDate;
/*     */   }
/*     */ 
/*     */   public void setHireDate(Date hireDate) {
/* 104 */     this.hireDate = hireDate;
/*     */   }
/*     */ 
/*     */   public boolean isSuperAdmin()
/*     */   {
/* 113 */     return "admin".equals(this.userId);
/*     */   }
/*     */ 
/*     */   public boolean isCreater() {
/* 117 */     return this.isCreater;
/*     */   }
/*     */ 
/*     */   public boolean isCanExport()
/*     */   {
/* 126 */     if ("admin".equals(this.userId)) {
/* 127 */       return true;
/*     */     }
/* 129 */     return this.canExport;
/*     */   }
/*     */ 
/*     */   public boolean isCanDelete()
/*     */   {
/* 138 */     if ("admin".equals(this.userId)) {
/* 139 */       return true;
/*     */     }
/* 141 */     return this.canDelete;
/*     */   }
/*     */ 
/*     */   public int getGroupId() {
/* 145 */     return this.groupId;
/*     */   }
/*     */ 
/*     */   public boolean isGroupAdmin() {
/* 149 */     return this.isGroupAdmin;
/*     */   }
/*     */ 
/*     */   public int getParentGroupId() {
/* 153 */     return this.parentGroupId;
/*     */   }
/*     */ 
/*     */   public void setParentGroupId(int parentGroupId) {
/* 157 */     this.parentGroupId = parentGroupId;
/*     */   }
/*     */ 
/*     */   public int getCustomerPageSize()
/*     */   {
/* 164 */     if ((this.extInfo == null) || (this.extInfo.size() == 0)) {
/* 165 */       return 10;
/*     */     }
/*     */ 
/* 168 */     String tmp = (String)this.extInfo.get(Integer.valueOf(1));
/* 169 */     if (tmp == null) {
/* 170 */       return 10;
/*     */     }
/* 172 */     int size = Util.str2Int(tmp);
/* 173 */     if (size <= 0) {
/* 174 */       return 10;
/*     */     }
/* 176 */     return size;
/*     */   }
/*     */ 
/*     */   public String getShowCustomeFieldTypeIds()
/*     */   {
/* 185 */     if ((this.extInfo == null) || (this.extInfo.size() == 0)) {
/* 186 */       return "";
/*     */     }
/*     */ 
/* 189 */     String tmp = (String)this.extInfo.get(Integer.valueOf(4));
/* 190 */     if (tmp == null) {
/* 191 */       return "";
/*     */     }
/* 193 */     return tmp;
/*     */   }
/*     */ 
/*     */   public boolean hasViewRight(int visible, String permissionsId, String shareUserIds, String shareGroupIds, CompanyInfo company)
/*     */   {
/* 207 */     if (this.isAdmin) {
/* 208 */       return true;
/*     */     }
/*     */ 
/* 211 */     if (visible == 1)
/*     */     {
/* 213 */       if ((permissionsId == null) || (permissionsId.trim().length() == 0)) {
/* 214 */         return true;
/*     */       }
/*     */ 
/* 218 */       int permissionsIdGroupId = Util.str2Int(permissionsId);
/* 219 */       if (!this.isGroupAdmin)
/*     */       {
/* 221 */         return this.groupId == permissionsIdGroupId;
/*     */       }
/*     */ 
/* 225 */       return company.isGroupAdmin(this, permissionsIdGroupId);
/*     */     }
/*     */ 
/* 229 */     if ((this.userId != null) && (this.userId.equals(permissionsId))) {
/* 230 */       return true;
/*     */     }
/*     */ 
/* 234 */     if ((shareUserIds != null) && (shareUserIds.trim().length() > 0) && 
/* 235 */       (Util.isInArray(shareUserIds.split(","), this.userId))) {
/* 236 */       return true;
/*     */     }
/*     */ 
/* 241 */     if ((this.groupId > 0) && 
/* 242 */       (shareGroupIds != null) && (shareGroupIds.trim().length() > 0))
/*     */     {
/* 244 */       if (Util.isInArray(shareGroupIds.split(","), 
/* 244 */         String.valueOf(this.groupId))) {
/* 245 */         return true;
/*     */       }
/*     */ 
/*     */     }
/*     */ 
/* 251 */     if (!this.isGroupAdmin) {
/* 252 */       return false;
/*     */     }
/*     */ 
/* 257 */     User user = company.getUser(permissionsId);
/* 258 */     if (user == null) {
/* 259 */       return false;
/*     */     }
/*     */ 
/* 262 */     return company.isGroupAdmin(this, user.groupId);
/*     */   }
/*     */ 
/*     */   public boolean hasViewDealRight(String responsibleUserId, CompanyInfo company)
/*     */   {
/* 275 */     if (this.isAdmin) {
/* 276 */       return true;
/*     */     }
/*     */ 
/* 280 */     if ((this.userId != null) && (this.userId.equals(responsibleUserId))) {
/* 281 */       return true;
/*     */     }
/*     */ 
/* 285 */     if (!this.isGroupAdmin) {
/* 286 */       return false;
/*     */     }
/*     */ 
/* 291 */     User user = company.getUser(responsibleUserId);
/* 292 */     if (user == null) {
/* 293 */       return false;
/*     */     }
/*     */ 
/* 296 */     return company.isGroupAdmin(this, user.groupId);
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.bean.User
 * JD-Core Version:    0.6.1
 */